| Conditions | 1 |
| Paths | 6 |
| Total Lines | 57 |
| Code Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | /** |
||
| 24 | constructor() { |
||
| 25 | //WIZARD |
||
| 26 | $(".tab-wizard").steps({ |
||
| 27 | headerTag: "h6", |
||
| 28 | bodyTag: "section", |
||
| 29 | transitionEffect: "fade", |
||
| 30 | titleTemplate: '<span class="step">#index#</span> #title#', |
||
| 31 | labels: { |
||
| 32 | finish: "Submit" |
||
| 33 | }, |
||
| 34 | onFinished: function (event, currentIndex) { |
||
| 35 | Swal("Form Submitted!", "Success"); |
||
| 36 | |||
| 37 | } |
||
| 38 | }); |
||
| 39 | |||
| 40 | |||
| 41 | var form = $(".validation-wizard").show(); |
||
| 42 | |||
| 43 | $(".validation-wizard").steps({ |
||
| 44 | headerTag: "h6", |
||
| 45 | bodyTag: "section", |
||
| 46 | transitionEffect: "fade", |
||
| 47 | titleTemplate: '<span class="step">#index#</span> #title#', |
||
| 48 | labels: { |
||
| 49 | finish: "Submit" |
||
| 50 | }, |
||
| 51 | onStepChanging: function (event, currentIndex, newIndex) { |
||
| 52 | return currentIndex > newIndex || !(3 === newIndex && Number($("#age-2").val()) < 18) && (currentIndex < newIndex && (form.find(".body:eq(" + newIndex + ") label.error").remove(), form.find(".body:eq(" + newIndex + ") .error").removeClass("error")), form.validate().settings.ignore = ":disabled,:hidden", form.valid()) |
||
| 53 | }, |
||
| 54 | onFinishing: function (event, currentIndex) { |
||
| 55 | return form.validate().settings.ignore = ":disabled", form.valid() |
||
| 56 | }, |
||
| 57 | onFinished: function (event, currentIndex) { |
||
| 58 | Swal("Form Submitted!", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lorem erat eleifend ex semper, lobortis purus sed."); |
||
| 59 | } |
||
| 60 | }), |
||
| 61 | $(".validation-wizard").validate({ |
||
| 62 | ignore: "input[type=hidden]", |
||
| 63 | errorClass: "text-danger", |
||
| 64 | successClass: "text-success", |
||
| 65 | highlight: function (element, errorClass) { |
||
| 66 | $(element).removeClass(errorClass) |
||
| 67 | }, |
||
| 68 | unhighlight: function (element, errorClass) { |
||
| 69 | $(element).removeClass(errorClass) |
||
| 70 | }, |
||
| 71 | errorPlacement: function (error, element) { |
||
| 72 | error.insertAfter(element) |
||
| 73 | }, |
||
| 74 | rules: { |
||
| 75 | email: { |
||
| 76 | email: !0 |
||
| 77 | } |
||
| 78 | } |
||
| 79 | }); |
||
| 80 | } |
||
| 81 | } |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.